<template>
	<view class="content">
		<image src="../../static/images/home/banner.png" mode="widthFix" class="bg-img"></image>
		<CustomNav :custom="custom" title="社区服务" :isBack="true" backColor="#fff" :topBgColor="topBgColor" color="#fff">
		</CustomNav>
		<view class="info-block">
			<view class="info-item">
				<view class="title FangZhengHanZhenGuangBiaoJianTi">社区服务</view>
				<view class="menu">
					<view class="menu-list" v-for="item in menuList" :key="item.id"
						@click="jumpMiniProgram(item.appid)">
						<image :src="item.img" class="menu-img"></image>
						<view class="menu-name">{{item.title}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getCustomNavData
	} from '@/util/util.js'
	export default {
		data() {
			return {
				custom: null,
				topBgColor: 'rgba(0,0,0,0)',
				menuList: [{
						id: 1,
						img: '/static/images/news/mashang.png',
						title: '码上就业',
						url: '',
						appid: 'wxef23838b87dfdfa4'
					},
					{
						id: 2,
						img: 'https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/dongbeijiedao/lg.png',
						title: '零工超市',
						url: '',
						appid: 'wx63326d0b5a594b38'
					}, {
						id: 3,
						img: 'https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/dongbeijiedao/yl.jpg',
						title: '医疗健康',
						url: '',
						appid: 'wxb032bc789053daf4'
					},
					{
						id: 4,
						img: 'https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/dongbeijiedao/cx.jpg',
						title: '出行服务',
						url: '',
						appid: 'wx65cc950f42e8fff1'
					},
					{
						id: 5,
						img: 'https://job-1306862033.cos.ap-chengdu.myqcloud.com/miniprogram-static/home/dongbeijiedao/legal_aid.png',
						title: '法律援助',
						url: '',
						appid: 'wx2173679ee6b98cbf'
					}
				],
			}
		},
		methods: {
			jumpMiniProgram(appid) {
				if (appid) {
					uni.navigateToMiniProgram({
						appId: appid
					})
				}
			},
		},
		onPageScroll(e) {
			if (e.scrollTop >= 1) {
				this.topBgColor = '#BA1519'
			} else {
				this.topBgColor = 'rgba(0,0,0,0)';
			}
		},
		onLoad() {
			this.custom = getCustomNavData();
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		.bg-img {
			width: 100%;
		}

		.info-block {
			display: flex;
			flex-direction: column;
			background: #F7F6F9;
			margin-top: -80rpx;
			border-radius: 60rpx;
			position: relative;
			padding: 30rpx;

			.info-item {
				background-color: #fff;
				padding: 30rpx;
				border-radius: 20rpx;

				.title {
					color: #BA1519;
				}

				.menu {
					display: flex;
					align-items: center;
					flex-wrap: wrap;
					margin-top: 30rpx;

					.menu-list {
						display: flex;
						flex-direction: column;
						width: calc(100% / 4);
						margin-top: 30rpx;
						justify-content: center;
						align-items: center;

						.menu-img {
							width: 110rpx;
							height: 110rpx;
							border-radius: 50%;
							margin-bottom: 15rpx;
						}

						.menu-name {
							font-size: 28rpx;
						}
					}
				}
			}
		}
	}
</style>